package cn.edu.xmu.oomall.customer.microservice;

import cn.edu.xmu.oomall.customer.microservice.vo.SimpleCouponActivityRetVo;
import cn.edu.xmu.oomall.customer.model.vo.CouponActivityVoInfo;
import cn.edu.xmu.oomall.customer.service.mq.CouponQuantityBody;
import cn.edu.xmu.privilegegateway.annotation.util.InternalReturnObject;
import com.github.pagehelper.PageInfo;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

/**
 * @author Jiawei Zheng
 * @date 2021-12-04
 */
@FeignClient(name = "coupon-service")
public interface CouponActivityService {

    /**
     * 根据productId查看商品的上线的优惠活动
     * @param productId
     * @param page
     * @param pageSize
     * @return
     */
    @GetMapping("products/{id}/couponactivities")
    InternalReturnObject<PageInfo<SimpleCouponActivityRetVo>> listCouponActivitiesByProductId(@RequestParam  @PathVariable("id") Long productId, @RequestParam Integer page, @RequestParam Integer pageSize);

    @GetMapping("/internal/couponactivities/{id}")
    InternalReturnObject<CouponActivityVoInfo> getCouponActivityById(@RequestParam @PathVariable("id") Long id);

    @PutMapping("/internal/decreasecouponactivities/{id}")
    InternalReturnObject<CouponActivityVoInfo> decreaseCouponActivityQuantityById(@RequestParam @PathVariable("id") Long id,@RequestBody CouponQuantityBody couponQuantityBody);
}
